<template>
	<view :style="{height: windowHeight+'px'}" class="w_100">
		<view class="p_r" style="width: 100%; height: 83%;background-color: #84938F;">
			
				<video src="../../static/video/v1.mp4" 
				controls=false 
				autoplay 
				show-fullscreen-btn=false
				@timeupdate="timeupdateFun"
				@loadedmetadata="loadedmetaFun"
				 object-fit="contain"
				 poster="../../static/video/vImg.jpg"
				 style="width: 100%;height: 100%;">
				<cover-view class="p_a btn" @tap="jumpBtn">跳过 {{timeNum}}s</cover-view>
				 </video>
			
		</view>
		<view class="d_f j_c_c" style="width: 100%; height: 17%;">
			<view class="d_f a_i_c">
				<image src="../../static/image/qyt.png" mode="" style="width: 150rpx;height:100rpx;"></image>
				<view class="d_f f_d_c ">
					<image src="../../static/image/qyz.png" mode="" style="width: 198rpx;height: 46rpx;"></image>
					<text style="font-size: 20rpx;margin-top: 20rpx;color: #999999;">家庭健康 轻松主导</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	var windowHeight = uni.getSystemInfoSync().windowHeight;
	export default {
		data() {
			return {
				windowHeight:windowHeight,
				duration:null,
				timeNum:10,
			}
		},
		onLoad() {
			this.setTime()
			
			
		},
		methods: {
			jumpBtn(){
				uni.switchTab({
				    url: '/pages/home/home'
				});
			},
			timeupdateFun(e){
				var duration = this.duration;
				if(!duration){
					this.duration = Math.round(e.detail.duration)
					this.timeNum = Math.round(e.detail.duration)
				}
				
			},
			loadedmetaFun(e){
				console.log(e)

			},
			setTime(){
				var i = setInterval(()=>{
					if(this.timeNum==0){
						clearInterval(i)
						this.jumpBtn()	
					}
					this.timeNum--
				},1000)
			}
		}
	}
</script>

<style>
.btn{
	width: 134rpx;
	height: 64rpx;
	border-radius: 30rpx;
	background-color: #282828;color: #FFFFFF;font-size: 24rpx;
	line-height: 64rpx;
	text-align: center;
	bottom: 40rpx;
	right: 40rpx;
}

</style>
